<%-- 
    Document   : listUsuarios
    Created on : 27/08/2013, 08:39:17
    Author     : 0875112
--%>

<%@page import="model.Profissional"%>
<%@page import="java.util.Iterator"%>
<%@page import="java.util.ArrayList"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>        
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <link href="css/bootstrap.min.css" rel="stylesheet" media="screen">
        <link href="css/style.css" rel="stylesheet" type="text/css" />
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
        <script type="text/javascript" src="js/bootstrap.min.js"></script>
        <title>Clínica Médica - Sua saúde em primeiro lugar</title>        
    </head>
      <script type="text/JavaScript">
               function doLoad() {
                setTimeout( "refresh()", 10000);
            }
               function refresh() {
                window.location.href = window.location;
            }

       </script>
    </head>
    <body onload="doLoad();">             
        <div class="container">
            <jsp:include page="cabecalho.jsp" flush="true" />       
            <div class="content">
                <div class="panel panel-default espaco-form">
                    <div class="row">
                        <div class="col-md-10">
                            <h3>Pesquisar Profissionais</h3>
                             </div>
                        <div class="col-md-2">
                            <a class="btn btn-success pull-right espaco-botao" href="javascript:history.back(1)" title="Voltar">Voltar</a>                    
                        </div>                        
                    </div>
                    <p>Aqui você visualiza os profissionais cadastrados no sistema.</p>        
                                                                   
                    <div class="table-responsive espaco-table">
                        <table class="table table-bordered table-striped table-hover">
                            <thead>
                                <tr>
                                    <th>Nome</th>
                                    <th>Endereço</th>
                                    <th>Telefone</th>
                                    <th>Celular</th>
                                    <th>E-mail</th>                                  
                                    <th>E-mail Clínica</th>
                                    <th>Data de Admissão</th>
                                    <th>Editar</th>
                                    <th>Excluir</th>
                                </tr>
                            </thead>
                            <tbody>
                                <% ArrayList lista = (ArrayList) session.getAttribute("listaPesquisarProfissionais");
                                Iterator it = lista.iterator();
                                while (it.hasNext()) {
                                Profissional prof = (Profissional) it.next();
                                int codigo = prof.getPessoa().getIdPessoa();
                                String nome = prof.getNome();
                                String cpf = prof.getCpf();
                                String rg = prof.getRg();
                                String dataNascimento = prof.getDataNasc();
                                String endereco = prof.getEndereco();
                                String telefone = prof.getTelefone();
                                String celular = prof.getCelular();
                                String email = prof.getEmail();
                                int numCrm = prof.getNumCRM();
                                String emailclinica = prof.getEmailClinica();
                                int numCarteira = prof.getNumCarteira();
                                String dataAdmissao = prof.getDataAdmissao();                                
                                %>
                                <tr>
                                    <td><%=nome%></td> 
                                    <td><%=endereco%></td>
                                    <td><%=telefone%></td>
                                    <td><%=celular%></td>
                                    <td><%=email%></td>
                                    <td><%=emailclinica%></td>                                    
                                    <td><%=dataAdmissao%></td>
                                    <td><form method="POST" action="FrontController">
                                        <input type="image" class="cimg-tam-menor" src="img/editar.png" alt="Editar" title="Editar" name="editar">
                                        <input type="hidden" name="servlet" value="EditarProfissional">
                                        <input type="hidden" name="idEditar" value="<%=prof.getPessoa().getIdPessoa()%>">
                                    </form></td>
                                    <td>
                                        <form method="POST" action="FrontController">
                                            <input type="image" class="img-tam-menor" src="img/deletar.png" alt="Excluir" title="Excluir" name="excluir">
                                            <input type="hidden" name="servlet" value="ExcluirProfissional">
                                            <input type="hidden" name="idExcluir" value="<%=codigo%>">
                                        </form>
                                    </td>
                                </tr>
                                <% } // Fecha o while%>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>  
            <jsp:include page="rodape.jsp" flush="true" />
        </div>        
    </body>
</html>
